<!DOCTYPE HTML>
<html>
	<head>
	<title>打板</title>
	<link href="css/text.css" rel="stylesheet" type="text/css" />
	<meta charset="utf-8" />
	<style>
		.fixedBox{
				border: 1px solid #555555;				
				white-space: nowrap;	
			}
			.fixedBox::-webkit-scrollbar {
				width: 12px;     
				height: 12px;				
			}			
		table{
			width:600px; 
			border-collapse:collapse; 
			text-align:center;
		}
		td,th{border:1px solid #696969}
	</style>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="DatePicker/WdatePicker.js"> </script>
	</head>
	<body>
		<div id="towrites" class="fixedBox" style="display:none;">
			<div class="fixedBox" style="position:relative;left:0px;width:1500px;">	<!-- 宽度调节 -->	
				<div id="towrite" class="fixedBox"></div>	
				<iframe height="550" id="mapIframe1" name="mapIframe" src=""></iframe>
			</div>
		</div>
		<div id="data"></div>		
		<script>
			var bkcolor = $("body").css("backgroundColor");
			var dt = "";
			var tt = "";			
			var k = 0;		
			window.onload = function() {
				var day = new Date();				
				mymonth = day.getMonth()+1;
				myday = day.getDate();
				if(mymonth >= 10){mymonth = mymonth;}else{mymonth = "0" + mymonth;}
				if(myday >= 10){myday = myday;}else{myday = "0" + myday;}
				tt = day.getFullYear() + "-" + mymonth + "-" + myday;
				//dt = tt;			
				changeStyle();
				getSource(1);
				
				var iframe1 = document.getElementById('mapIframe1');				
				iframe1.src = "连板(未涨停).html";	
			}
						
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {					
					getSource(fs);
					<!-- trid = ""; -->
					<!-- trs = ""; -->
					thclick();
					changeCss(objt,"gg");
					console.log(true)　　　　　　
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}　　　
   　　　
			$(function() {
				setInterval(function() {
					if(k == 0){				
						time_range("9:00","15:15")
					}				
				},
				60000);
			})
			
			function thclick() {
				sfx = 1;
				var table = document.getElementById('towrite').getElementsByTagName("table")[0];
				var headers = table.getElementsByTagName("th");
				headers[rn].onclick();
			}
			
			function changeStyle() {
				var div = document.getElementById("towrites");
				div.style.display= "block";
				//div.style.position= "relative"; 				
				div.style.left= "0px"; 				
				div.style.width= "100%";
				//div.style.height= "550px";
				//div.style.border= "2px solid #fff"
				
				var obj1 = document.getElementById("towrite");
				obj1.style.position= "relative";
				obj1.style.marginTop= "-10px";
 				obj1.style.float= "left";
				obj1.style.left= "0px"; 				
				obj1.style.width= "1000px";	
				//obj1.style.height= "100%";		
				obj1.style.fontSize= "12px";
				obj1.style.border= "1px solid #DCDCDC";
				
				var obj2 = document.getElementById("mapIframe1");
				obj2.style.position= "relative"; 
				obj2.style.float= "left";
				obj2.style.marginLeft= "10px";
				obj2.style.width= "380px";	
				obj2.style.fontSize= "12px";
				//obj2.style.height= "500px";				
			}
			
			function keepTwoDecimal(num) {  
               var result = parseFloat(num);  
               if (isNaN(result)) {                    
                   return false;  
               }  
               result = Math.round(num * 100) / 100;  
               return result;  
			};
			
			var xt = 1; //涨停原因相同行高亮（1:true; 0:false;）
			var trid = "";
			var trs = "";
			var objt = "";
			function changeCss(obj,id){	
				if(obj){
					trs = "";
					objt = obj;
					var t = obj.parentNode.parentNode.id;  //td父节点tr id
					var ty = t.split("#")[1];
					var ty1 = "";
					var ty2 = "";
					if(ty.indexOf("、") > -1){
						ty1 = ty.split("、")[0];
						ty2 = ty.split("、")[1];
					}
					
					var tlist = document.getElementById(id).getElementsByTagName("tr");					
					for(var i = 0; i < tlist.length; i++){
						if(tlist[i].id != ""){
							var dm = tlist[i].id.split("#")[0];
							var yy = tlist[i].id.split("#")[1];
							if(xt == 1){   //涨停原因相同行高亮
								if(t == tlist[i].id){
									tlist[i].style.backgroundColor = "#483D8B";  //选中行
									trid = t;
								}else if(ty.indexOf("、") > -1){
									if(yy.indexOf(ty1) > -1 || yy.indexOf(ty2) > -1){
										tlist[i].style.backgroundColor = "#800080"; //相同涨停原因
										trs += tlist[i].id;
									}else{
										tlist[i].style.backgroundColor = bkcolor; 				
									}	
								}else{
									if(yy.indexOf(ty) > -1){
										tlist[i].style.backgroundColor = "#800080"; //相同涨停原因
										trs += tlist[i].id;
									}else{
										tlist[i].style.backgroundColor = bkcolor; 				
									}	
								}	
							}else{
								if(t == tlist[i].id){
									tlist[i].style.backgroundColor = "#483D8B";  //选中行
									trid = t;
								}else{
									tlist[i].style.backgroundColor = bkcolor; 				
								}	
							}							
						}					
					}				
				}
			}
			
			function hover(){  //鼠标经过
				var rows = document.getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){							
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){						
						if(this.id != ""){  //过滤表头
							if(this.id == trid){  //过滤选中行
								this.style.background="#483D8B";
							}else if(trs.indexOf(this.id) > -1){
								this.style.background="#800080";
							}else{
								this.style.background=bkcolor;
							}
						}						
					}					
				}
			}			
			
			function NumberTransform(num) { 
				var result = parseFloat(num);
				if (isNaN(result)) {                    
                   return false;  
               }  				
 				//var result = 110000000;  
               if(Math.abs(result) > 100000000){
			   //alert(1)
				result = result / 100000000;
				result = result.toFixed(2) + "亿";
			   }else if(Math.abs(result) > 10000){
			   // alert(2)
			    result = result/10000;
				result = result.toFixed(0) + "万";
			   }
			    //alert(result)
               return result;  
			};	
			
			Date.prototype.Format = function (fmt) {
				var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
				};
				if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
				return fmt;
			};
			
			function getLocalTime(nS) {			          
				return new Date(parseInt(nS*1000)).Format("hh:mm:ss")
			}

					
			function cDayFunc(dp){ 
				var date = dp.cal.getNewDateStr();            
				BookingRmk(date);//调用其它函数并带上参数                
			}
			
			function BookingRmk(date){         
				tt = date;
				var date1 = new Date(tt);
				var date2 = new Date(dt);
				k = 0;
				if(date1.getTime() < date2.getTime()){			
					k = 1;
					tradeday();
				}
				trid = "";
				trs = "";
				objt = "";
				getSource(fs);	
				
				mapIframe.window.BookingRmk(tt);
			}
			
			function prev(){  //前一天
				pn = -1;
				var day = new Date(tt);	
				day.setTime(day.getTime() - 24*60*60*1000);	
				tt = day.Format("yyyy-MM-dd");
				BookingRmk(tt);
			}
			
			function next(){  //后一天 				
				pn = 1;
				var day = new Date(tt);	
				day.setTime(day.getTime() + 24*60*60*1000);	
				tt = day.Format("yyyy-MM-dd");
				BookingRmk(tt);							
			}
			
			var pn = -1;
			function tradeday() {  //判断最后交易日
				var day = new Date(tt);							
				for (i = 1; i < 100; i++){	//节假日																										
					if(i > 1){
						day.setTime(day.getTime() + pn*24*60*60*1000);							
					}	
					tt = day.Format("yyyy-MM-dd");
					//alert(tt);
					if(tt == dt){	
						k = 0;
						getSource(fs);
						break;
					}
					var url = "http://127.0.0.1:8881/w1/api/index.php?Order=1&a=HisDaBanList&st=10&c=HisHomeDingPan&Is_st=1&PidType=2&apiv=w30&Type=6&Day=" + tt;
					var res = [];
					$.ajax({
						type: "get",
						url: url,
						dataType: "json",
						async : false,
						cache:false,
						timeout:3000,						
						success: function(data) {							
							res = data.list;							
						}
					});
					if(res.length != 0){						
						break;
					}
				}
			}				
			
			var fs = "";
			var type = "";
			var pid = "";
			function getSource(p) {	
				if(k == 1 && p == 1){
					p = 2;
				}
				if(rn == 100 || fs != p || k == 1){  //初始或切换
					if(p == 2){
						rn = 2;
					}else{
						rn = 3;
					}
					objt = "";
					fls = true; //切换恢复初始排序反向
				}	
				
				fs = p;				
				div = document.getElementById('towrite');				
				var p1 = "<a href='javascript:void(0)' id='px1' onclick='getSource(" + "1" + ")'>" + "即将涨停" + "</a>";
				if(k == 1){
					p1 = "";					
				}
				var p2 = "<a href='javascript:void(0)' id='px2' onclick='getSource(" + "2" + ")'>" + "涨停" + "</a>";	
				var p3 = "<a href='javascript:void(0)' id='px3' onclick='getSource(" + "3" + ")'>" + "炸板" + "</a>";
				var p4 = "<a href='javascript:void(0)' id='px4' onclick='getSource(" + "4" + ")'>" + "自然涨停" + "</a>";				
				div.innerHTML = '<font size="4">打板</font><font size="2">（ ' + p1 + p2 + p3 + p4 + '）</font><input style="width: 100px;" type="text" id="PriceDate" name="PriceDate" class="Wdate" onFocus="WdatePicker({ onpicking: cDayFunc})" />';						
				var back = '<a href="javascript:prev();"  style="position:absolute; left:420px;font-size:16px;color:#fff;">←</a>';				
				var forward = '<a href="javascript:next();"  style="position:absolute; left:460px;font-size:16px;color:#fff;">→</a>';
				div.innerHTML += back + forward + '<br><br>';
				
				aObj = document.getElementById('px' + p);				
				aObj.style.color = "#FFA07A";
				
								
				if(p == 1){
					pid = "0";
					type = "4";
					gl = "涨幅";					
				}else if(p == 2){
					pid = "1";
					type = "6";	
					gl = "涨停时间";
				}else if(p == 3){
					pid = "2";
					type = "4";
					gl = "涨停时间";
				}else if(p == 4){
					pid = "4";
					type = "6";
					gl = "涨停时间";
				}
				
								
				res = [];				
				var num = 60; 
				for (var i = 0; i < 100; i++){						
					var page = (i * num);					
					var url1 = "http://127.0.0.1:8880/w1/api/index.php?Order=1&a=DaBanList&st=" + num + "&apiv=w21&Type=" + type + "&c=HomeDingPan&Index=" + page + "&Is_st=1&PidType=" + pid;						
					var url2 = "http://127.0.0.1:8881/w1/api/index.php?Order=1&a=HisDaBanList&st=" + num + "&c=HisHomeDingPan&Index=" + page + "&Is_st=1&PidType=" + pid + "&apiv=w30&Type=" + type + "&Day=" + tt;
					var url = url1;
					if(k == 1){
						url = url2;
					}
					var arr = [];
					$.ajax({
						type: "get",
						url: url,
						dataType: "json",
						async : false,
						cache:false,
						timeout:3000,					
						success: function(data) {
							//alert(JSON.stringify(data))						
							//document.write(JSON.stringify(data));							
							arr = data.list;
							if(arr.length > 0){
								if(k == 0 && i == 0){
									tt = data.day;								
									dt = tt;
								}
								res = res.concat(arr);
							}									
						}
					});
					if(arr.length == 0){
						break;
					}
				}					
				//document.write(JSON.stringify(res));	
				writeSource(res);
			}
			
			var bj = [];			
			var gl = "";  //高亮
			function writeSource(data) { 								
				res = [];				
				if(fs == 1){
					//gl = "涨幅";					
					for (i = 0; i < data.length; i++){
						res.push({"代码":data[i][0],"名称":data[i][1],"现价":data[i][17],"涨幅%":data[i][4],"涨速%":data[i][5],"实际换手%":data[i][14],"板块":data[i][11]});							
					}					
				}else if(fs == 2){
					//gl = "涨停时间";					
					for (i = 0; i < data.length; i++){
						res.push({"代码":data[i][0],"名称":data[i][1],"涨停时间":getLocalTime(data[i][6]),"最后涨停时间":getLocalTime(data[i][25]),
						          "状态":data[i][9],"最大封单":NumberTransform(data[i][23]),"封单":NumberTransform(data[i][8]),"实际换手%":data[i][14],
								  "实际流通":NumberTransform(data[i][15]),"主力净额":NumberTransform(data[i][12]),"成交额":NumberTransform(data[i][13]),
								  "涨停原因":data[i][16] + "(" + data[i][27] + ")","板块":data[i][11]});							
					}					
				}else if(fs == 3){
					//gl = "涨停时间";					
					for (i = 0; i < data.length; i++){
						res.push({"代码":data[i][0],"名称":data[i][1],"现价":data[i][17],"涨幅%":data[i][4],"涨停时间":getLocalTime(data[i][6]),"开板时间":getLocalTime(data[i][7]),
						          "实际换手%":data[i][14],"实际流通":NumberTransform(data[i][15]),"主力净额":NumberTransform(data[i][12]),
								  "成交额":NumberTransform(data[i][13]),"板块":data[i][11]});								
					}
					if(k == 1){
						res = [];
						for (i = 0; i < data.length; i++){
							res.push({"代码":data[i][0],"名称":data[i][1],"涨幅%":data[i][4],"涨停时间":getLocalTime(data[i][6]),"开板时间":getLocalTime(data[i][7]),
									  "实际换手%":data[i][14],"实际流通":NumberTransform(data[i][15]),"主力净额":NumberTransform(data[i][12]),
									  "成交额":NumberTransform(data[i][13]),"板块":data[i][11]});								
						}					
					}
				}else if(fs == 4){
					//gl = "涨停时间";					
					for (i = 0; i < data.length; i++){
						res.push({"代码":data[i][0],"名称":data[i][1],"现价":data[i][17],"涨停时间":getLocalTime(data[i][6]),"最后涨停时间":getLocalTime(data[i][25]),
						          "状态":data[i][9],"最大封单":NumberTransform(data[i][23]),"封单":NumberTransform(data[i][8]),"实际换手%":data[i][14],
								  "实际流通":NumberTransform(data[i][15]),"主力净额":NumberTransform(data[i][12]),"成交额":NumberTransform(data[i][13]),
								  "涨停原因":data[i][16] + "(" + data[i][27] + ")","板块":data[i][11]});							
					}
					if(k == 1){
						res = [];
						for (i = 0; i < data.length; i++){
							res.push({"代码":data[i][0],"名称":data[i][1],"涨停时间":getLocalTime(data[i][6]),"状态":data[i][9],"封单":NumberTransform(data[i][8]),
							          "实际换手%":data[i][14],"实际流通":NumberTransform(data[i][15]),"主力净额":NumberTransform(data[i][12]),"成交额":NumberTransform(data[i][13]),
								      "涨停原因":data[i][16] + "(" + data[i][27] + ")","板块":data[i][11]});									
						}					
					}
				}
				
				var json = res;  
				
				//创建table					
				var table=document.createElement("table");										
				var thead=document.createElement("thead");
				table.appendChild(thead);					
				var tr=document.createElement("tr");
				thead.appendChild(tr);					
				
				var m = 0;
				var n = 0;
				var b = 0;
				bj = [];				
				for(var key in json[0]){  //表头											
					var th=document.createElement("th");						
					th.innerHTML=key;						
					tr.appendChild(th);
					if(gl == key.replace("%","")){
						n = m;
						th.style.color = "#FFFF80";	
					}
					if(key == "板块" || key == "状态" || key == "涨停原因"){
						if(key == "涨停原因"){
							b = m;
						}
						if(b == 0 && key == "板块"){
							b = m;
						}
						bj.push(m);
						th.style.color = "#FFA500";	
					}
					m++;
				}
				var tbody=document.createElement("tbody");					
				table.appendChild(tbody);
				
				//遍历json
				for(var i = 0; i < json.length; i++){		//行元素遍历			
					var tr=document.createElement("tr");						
					var p = 1;
					var dm = "";
					var mc = "";
					for(var key in json[i]){ 						
						var td=document.createElement("td");							
						
						var rc = json[i][key];
						if(p == 1){  //代码列
							dm = rc;
							tr.id = dm;
						}else if(p == b + 1){
							zt = rc;
							tr.id = dm + "#" + zt;
						}					
						//td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "' onclick='changeCss(this,\"" + dm + "\",\"gg\")'>" + rc + "</a>";
						td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "' onclick='changeCss(this,\"gg\")'>" + rc + "</a>";

						if(p == n + 1){							
							td.getElementsByTagName("a")[0].style.color = "#FF6633";
						}
						
						if(bj.indexOf(p - 1) > -1){	
							td.getElementsByTagName("a")[0].style.color = "#FFA500";
						}																
						tr.appendChild(td);							
						p++;
					}														
					tbody.appendChild(tr);																
				}					
				var div = document.getElementById("towrite");									
				div.appendChild(table);
				table.id = "gg";	
					
				document.getElementById("PriceDate").value = tt;
				
				makeSortable(table);				
				hover();
			}
			
			var rn = 100;
			var sfx = 0;  //自动刷新开关
			var fls = true;  //排序方向
			function makeSortable(table) {				
				var headers=table.getElementsByTagName("th");
				var m1 = 0; //涨停时间
				var m2 = 0; //连板
				for(var i=0;i<headers.length;i++){				
					(function(n){
						var flag = false;
						
						if(headers[i].textContent == "涨停时间"){							
							m1 = i;
						}	
						if(headers[i].textContent == "状态"){							
							m2 = i;
						}
						
						headers[n].onclick=function(){							
							//alert(n)
							rn = n;
							gl = headers[n].textContent;							
							showCol(n,bj);		//高亮							
							var tbody=table.tBodies[0];
							var rows=tbody.getElementsByTagName("tr");
							rows=Array.prototype.slice.call(rows,0);

							//基于第n个<td>元素的值对行排序
							rows.sort(function(row1,row2){
								headtxt = headers[n].textContent;								
								var cell1=row1.getElementsByTagName("td")[n];//获得第n个单元格
								var cell2=row2.getElementsByTagName("td")[n];																
								var val1=cell1.textContent||cell1.innerText;//获得文本内容
								var val2=cell2.textContent||cell2.innerText;
								if(headtxt.indexOf("涨停原因") != -1){									
									
									var sj1=row1.getElementsByTagName("td")[m1];//涨停时间
									var sj2=row2.getElementsByTagName("td")[m1];																
									var s1=sj1.textContent||sj1.innerText;
									var s2=sj2.textContent||sj2.innerText;
									
									var lb1=row1.getElementsByTagName("td")[m2];//连板
									var lb2=row2.getElementsByTagName("td")[m2];																
									var b1=lb1.textContent||lb1.innerText;
									var b2=lb2.textContent||lb2.innerText;
									b1 = b1.replace("首板","1板").replace("新上市未开板","0");
									b2 = b2.replace("首板","1板").replace("新上市未开板","0");
										
									val11 = val1.split("(")[0];
									val21 = val2.split("(")[0];
									val12 = parseInt(val1.split("(")[1].split(")")[0]);
									val22 = parseInt(val2.split("(")[1].split(")")[0]);
									
									if(val12 < val22){
										return -1;
									}else if(val12 > val22){
										return 1;
									}else if(val12 == val22 && val11 > val21){
										return 1;
									}else if(val12 == val22 && val11 < val21){
										return -1;
									}else if(val12 == val22 && val11 == val21 && b1 > b2){
										return 1;
									}else if(val12 == val22 && val11 == val21 && b1 < b2){
										return -1;	
									}else if(val12 == val22 && val11 == val21 && b1 == b2 && s1 > s2){
										return -1;
									}else if(val12 == val22 && val11 == val21 && b1 == b2 && s1 < s2){
										return 1;
									}else{
										return 0;
									}
								}else if(headtxt.indexOf("状态") != -1){									
									val1 = val1.replace("昨日首板","-1").replace("首板","1").replace("连板","");
									if(val1.indexOf("天")>-1){
										val1 = val1.split("天")[0] - 0.5;
									}else if(val1.indexOf("昨")>-1){
										val1 = 0;
									}else if(val1 == ""){
										val1 = -2;
									}										
									val1 = parseFloat(val1);
								
									val2 = val2.replace("昨日首板","-1").replace("首板","1").replace("连板","");
									if(val2.indexOf("天")>-1){
										val2 = val2.split("天")[0] - 0.5;
									}else if(val2.indexOf("昨")>-1){
										val2 = 0;
									}else if(val2 == ""){
										val2 = -2;
									}									
									val2 = parseFloat(val2);
									
									var sj1=row1.getElementsByTagName("td")[m1];//涨停时间
									var sj2=row2.getElementsByTagName("td")[m1];																
									var s1=sj1.textContent||sj1.innerText;
									s1 = s1.replace(/:/g,"");
									var s2=sj2.textContent||sj2.innerText;
									s2 = s2.replace(/:/g,"");
									
									if(val1 < val2){										
										return -1;
									}else if(val1 > val2){										
										return 1;
									}else{										
										if(s1 > s2){
											return -1;
										}else if(s1 < s2){
											return 1;
										}else{
											return 0;
										}										
									}
								}else if(headtxt.indexOf("名称") != -1 || headtxt.indexOf("板块") != -1 || headtxt.indexOf("时间") != -1 ){
									val1 = val1;
									val2 = val2;
									
									if(val1<val2){										
										return -1;
									}else if(val1>val2){										
										return 1;
									}else{
										return 0;
									}
								}else{
									if(val1 == "-"){
										val1 = " ";
									}
									if(val2 == "-"){
										val2 = " ";
									}
									val1 = val1.replace(" ","0").replace("无","1000").replace("NaN","0");
									val2 = val2.replace(" ","0").replace("无","1000").replace("NaN","0");
									if(val1.indexOf("万") != -1){
										val1 = parseFloat(val1)*10000;
									}else if(val1.indexOf("亿") != -1){
										val1 = parseFloat(val1)*100000000;
									}else{
										val1 = parseFloat(val1);
									}
									
									if(val2.indexOf("万") != -1){
										val2 = parseFloat(val2)*10000;
									}else if(val2.indexOf("亿") != -1){
										val2 = parseFloat(val2)*100000000;
									}else{
										val2 = parseFloat(val2);
									}
									
									if(val1<val2){										
										return -1;
									}else if(val1>val2){										
										return 1;
									}else{
										return 0;
									}
								}
								
							});	
							
							
							if(sfx == 1){   //自动刷新时，保持排序方向
								flag = fls;
							}
							fls = flag;
							sfx = 0;
							
							if(flag){
								rows.reverse();
							}
							
							for(var i=0;i<rows.length;i++){
								tbody.appendChild(rows[i]);
							}
							
							flag=!flag;	
						}
					}(i));
				}
			}
			
			function showCol(iCol,arr){	 //(选中列，标记列)	
				var oTable = document.getElementsByTagName('table')[0];						
				//表头
				var th = oTable.getElementsByTagName("th");						
				for (var i=0;i < th.length; i++){	    //列遍历
					th[i].style.color = "#E5E5E5";      //还原					
					if(arr.length > 0 && arr.indexOf(i) > -1){  //BJ列高亮
						th[i].style.color = "#FFA500";
					}
					th[iCol].style.color = "#FFFF80";	//选中				
				}
				
				var tr = oTable.getElementsByTagName("tr");	
				for (var i=1;i < tr.length; i++){	//行遍历
					var otagsA = tr[i].getElementsByTagName("a");
					for (var j=0;j < otagsA.length; j++){	//列遍历
						otagsA[j].style.color = "#E5E5E5";	//还原																
						if(arr.length > 0 && arr.indexOf(j) > -1){  //BJ列高亮
							otagsA[j].style.color = "#FFA500";
						}
					}
					var value = otagsA[iCol].innerText.replace(/(万)|(亿)/g,'');
					if(!isNaN(parseFloat(value)) && isFinite(value)){  //判断列是否为数字
						if(parseFloat(value) >= 0){
							otagsA[iCol].style.color = "#FF6633";     //正负颜色
						}else{
							otagsA[iCol].style.color = "#00FF00";
						}
					}else{
						otagsA[iCol].style.color = "#FF6633";
					}					
				}					
			}	

		</script>		
	</body>
</html>